<f:if condition="{existTemplate}">
    <h3>
        <f:translate key="{LLPrefix}currentTemplate"/>
    </h3>
    <div>
        <core:iconForRecord table="sys_template" row="{templateRecord}"/>
        <strong>
            <f:format.raw>{linkWrapTemplateTitle}</f:format.raw>
        </strong>
        <f:if condition="{templateRecord.sitetitle} != ''">
            ({templateRecord.sitetitle})
        </f:if>
    </div>
</f:if>
<f:if condition="{manyTemplatesMenu}">
    <f:format.raw>
        {manyTemplatesMenu}
    </f:format.raw>
</f:if>
<f:if condition="{typoScriptPath}">
    <f:then>
        <f:if condition="{existTemplate}">
            <f:then>
                <div style="padding-top: 10px;">
                    <div class="form-group">
                        <h3>
                            <f:translate key="{LLPrefix}editProperty"/>
                        </h3>
                        <label>{typoScriptPath} =</label>
                        <f:form.textfield class="form-control" name="data[{typoScriptPath}][value]" value="{theSetupValue}"/>
                    </div>
                    <f:form.submit value="{f:translate(key:'{LLPrefix}updateButton')}" class="btn btn-default"
                                                name="update_value"/>
                </div>
                <div style="padding-top: 20px">
                    <div class="form-group">
                        <h3>
                            <f:translate key="{LLPrefix}addProperty"/>
                        </h3>
                    </div>
                    <div class="form-inline form-inline-spaced">
                        <div class="form-group">
                            <label class="sr-only">{typoScriptPath}.</label>
                            <div class="input-group">
                                <div class="input-group-addon">{typoScriptPath}.</div>
                                <f:form.textfield class="form-control" name="data[{typoScriptPath}][name]"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>=</label>
                        <f:form.textfield class="form-control" name="data[{typoScriptPath}][propertyValue]"/>
                    </div>
                    <div class="form-group">
                        <f:form.submit class="btn btn-default" name="add_property"
                                                    value="{f:translate(key:'{LLPrefix}addButton')}"/>
                    </div>
                </div>
                <div style="padding-top: 20px;">
                    <div class="form-group">
                        <h3>
                            <f:translate key="{LLPrefix}clearObject"/>
                        </h3>
                    </div>
                    <div class="form-inline form-inline-spaced">
                        <div class="form-group">
                            <div class="checkbox">
                                <label>
                                    {typoScriptPath}
                                    <f:format.case mode="upper">
                                        <f:translate key="{LLPrefix}clear"/>
                                    </f:format.case>
                                    <f:form.checkbox name="data[{typoScriptPath}][clearValue]" value="1"/>
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <f:form.submit class="btn btn-default" name="clear_object"
                                                        value="{f:translate(key:'{LLPrefix}clearButton')}"/>
                        </div>
                    </div>
                </div>
                <f:if condition="{isNotInTopLevelKeyList}">
                    <f:then>
                        <f:if condition="{hasProperties}">
                            <f:link.external uri="{moduleUrlObjectListAction}" defaultScheme="" class="btn btn-default">
                                <f:translate key="{LLPrefix}addKey" arguments="{0:'{typoScriptPath}'}"/>
                            </f:link.external>
                        </f:if>
                    </f:then>
                    <f:else>
                        <f:link.external uri="{moduleUrlObjectListAction}" defaultScheme="" class="btn btn-default">
                            <f:translate key="{LLPrefix}removeKey" arguments="{0:'{typoScriptPath}'}"/>
                        </f:link.external>
                    </f:else>
                </f:if>
            </f:then>
            <f:else>
                {typoScriptPath} = <strong>{theSetupValue}</strong>
            </f:else>
        </f:if>
        <div>
            <hr style="margin-top: 5px; margin-bottom: 5px;"/>
            <f:link.external uri="{moduleUrl}" defaultScheme="" class="btn btn-default">
                <strong><i class="fa fa-chevron-left"></i>&nbsp;
                    <f:translate key="{LLPrefix}back"/>
                </strong>
            </f:link.external>
        </div>
    </f:then>
    <f:else>
        <f:be.pageRenderer includeRequireJsModules="{0: 'TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser'}"/>
        <div class="tsob-menu">
            <div class="form-inline">
                <f:if condition="{hasTsBrowserTypes}">
                    <div class="form-group">
                        <label class="control-label">
                            <f:translate key="{LLPrefix}browse"/>
                        </label>
                        <f:format.raw>{browserTypeDropdownMenu}</f:format.raw>
                    </div>
                </f:if>
                <f:if condition="{hasTopLevelInObjectList}">
                    <div class="form-group">
                        <label class="control-label" for="ts_browser_toplevel_{tsBrowserType}">
                            <f:translate key="{LLPrefix}objectList"/>
                        </label>
                        <f:format.raw>{objectListDropdownMenu}</f:format.raw>
                    </div>
                </f:if>
                <div class="form-group">
                    <label class="control-label" for="search_field">
                        <f:translate key="{LLPrefix}search"/>
                    </label>
                    <div class="form-group"><input class="form-control" type="search" name="search_field" id="search_field"
                                                                                value="{postSearchField}"/></div>
                </div>
                <input class="btn btn-default tsob-search-submit" type="submit" name="search"
                            value="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:search')}"/>
            </div>
            <div class="checkbox">
                <label for="checkTs_browser_regexsearch">
                    <f:format.raw>{regexSearchCheckbox}</f:format.raw>
                    <f:translate key="{LLPrefix}regExp"/>
                </label>
            </div>
        </div>
        <f:if condition="{hasParseErrors}">
            <div style="padding-top: 10px;"></div>
            <f:be.infobox title="{f:translate(key: '{LLPrefix}errorsWarnings')}" state="1">
                <f:for each="{parseErrors}" as="parseError">
                    <f:translate key="{LLPrefix}severity.{parseError.1}"/>
                    : {parseError.0}
                    <f:link.external uri="{showErrorDetailsUri}{parseError.2}" defaultScheme="" class="text-warning">
                        <f:translate key="{LLPrefix}errorShowDetails"/>
                    </f:link.external>
                    <br/>
                </f:for>
            </f:be.infobox>
        </f:if>
        <div class="panel panel-space panel-default">
            <div class="panel-heading">
                <f:if condition="{hasKeySelected}">
                    <f:then>
                        <strong>{treeLabel}</strong>
                    </f:then>
                    <f:else>
                        <f:format.case mode="upper">
                            <f:translate key="{LLPrefix}{rootLLKey}" />
                        </f:format.case>
                    </f:else>
                </f:if>
                <strong>{selectedKey}</strong>
                <f:if condition="{moduleUrlRemoveFromObjectList}">
                    <f:link.external uri="{moduleUrlRemoveFromObjectList}" defaultScheme="" class="btn btn-default">
                        <f:translate key="{LLPrefix}removeKey" />
                    </f:link.external>
                </f:if>
            </div>
            <div class="panel-body tstemplate-tsobjectbrowser-content"><f:format.raw>{tsTree}</f:format.raw></div>
        </div>
        <div>
            <h2><f:translate key="{LLPrefix}displayOptions" /></h2>
            <div class="typo3-listOptions">
                <div class="checkbox">
                    <label for="checkTs_browser_showComments">
                        <f:format.raw>{checkBoxShowComments}</f:format.raw>
                        <f:translate key="{LLPrefix}displayComments" />
                    </label>
                </div>
                <div class="checkbox">
                    <label for="checkTs_browser_alphaSort">
                        <f:format.raw>{checkBoxAlphaSort}</f:format.raw>
                        <f:translate key="{LLPrefix}sortAlphabetically" />
                    </label>
                </div>
            </div>
            <f:if condition="{isSetupAndCropLinesDisabled}">
                <div class="form">
                    <label><f:translate key="{LLPrefix}displayConstants" /></label>
                    <f:format.raw>{dropdownDisplayConstants}</f:format.raw>
                </div>
            </f:if>
            <f:if condition="{hasConditions}">
                <h2><f:translate key="{LLPrefix}conditions" /></h2>
                <div class="typo3-listOptions">
                    <f:for each="{tsConditions}" as="condition">
                        <div class="checkbox">
                            <label for="check{condition.key}">
                                <f:form.checkbox class="checkbox" name="conditions[{condition.key}]" id="check{condition.key}" value="{condition.value}" checked="{condition.isSet}" />
                                <f:format.raw>{condition.label}</f:format.raw>
                            </label>
                        </div>
                    </f:for>
                </div>
                <f:form.submit class="btn btn-default" value="{f:translate(key: '{LLPrefix}setConditions')}" name="Submit"/>
            </f:if>
        </div>
    </f:else>
</f:if>
